package com.yue.ssa.bean;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

@ApiModel("菜单")
public class Menu implements Serializable {

    @ApiModelProperty("主键")
    private String id;
    @ApiModelProperty("描述")
    private String des;
    @ApiModelProperty("代码")
    private String code;
    @ApiModelProperty("父主键")
    private String pid;
    @ApiModelProperty("是否叶节点")
    private boolean leaf;
//    @ApiModelProperty("子菜单")
//    @TableField(exist = false)
//    private Set<Menu> children = new HashSet<>();
    @ApiModelProperty("操作权限 0 可读 1可读可写")
    @TableField(exist = false)
    private boolean op;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

//    public Set<Menu> getChildren() {
//        return children;
//    }
//
//    public void setChildren(Set<Menu> children) {
//        this.children = children;
//    }

    public boolean isOp() {
        return op;
    }

    public void setOp(boolean op) {
        this.op = op;
    }

    public boolean isLeaf() {
        return leaf;
    }

    public void setLeaf(boolean leaf) {
        this.leaf = leaf;
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Menu) {
            Menu menu = (Menu) obj;
            return this.id.equals(menu.getId());
        }
        return false;
    }
}
